//////////////////////////////////////////////////////////////////////////////////
//
//	DoD Stronger Rifles
//		- Version 1.0
//		- 12.18.2006
//		- diamond-optic (original code by FireStorm)
//
//////////////////////////////////////////////////////////////////////////////////
//
// Credits:
//
//	- FireStorm & Fritz Schroeder for Uber Garand & Uber Rifles plugins
//	- Zor, SidLuke, Damaged Soul, and XxAvalanchexX
//
// Information:
//
// 	- Very often you'll be aiming at a players chest, but the
//	  shot gets registered on the 'arm' hitbox, giving a 90dmg hit...
//	  This plugin makes the arms & stomach do chest damage.
//	- I made this because i didnt like the 1 shot killing of the
//	  uber garand/rifles plugin, so now leg shots wont always kill...
//
// CVARs: 
//
//	dod_stronger_rifles "1" 		//turn ON(1)/OFF(0)
//	dod_stronger_rifles_m1 "1" 		//enable M1 Garand
//	dod_stronger_rifles_k43 "1" 		//enable for K43
//
// Changelog:
//
//	- 12.18.2006 Version 1.0
//		Initial Release
//
//////////////////////////////////////////////////////////////////////////////////

#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#include <dodx>

new p_strongsemiautos, p_m1, p_k43

public plugin_init()
{
	register_plugin("DoD Stronger Rifles","1.0","AMXX DoD Team")
	register_cvar("dod_stronger_rifles_stats", "1.0", FCVAR_SERVER|FCVAR_SPONLY)
	
	register_forward(FM_TraceLine,"check_shizot",1)
	register_statsfwd(XMF_DEATH)
	
	p_strongsemiautos = register_cvar("dod_stronger_rifles","1")
	p_m1 = register_cvar("dod_stronger_rifles_m1","1")
	p_k43 = register_cvar("dod_stronger_rifles_k43","1")
}

public check_shizot(Float:v1[3],Float:v2[3],noMonsters,id)
{
	if(get_pcvar_num(p_strongsemiautos) && is_user_connected(id) && is_user_alive(id))
		{	
		new victim = get_tr(TR_pHit)
	
		if(is_user_connected(victim) && is_user_alive(victim))	
			{
			new ammo, clip, zGun = dod_get_user_weapon(id,clip,ammo)
	
			if((zGun == DODW_GARAND && get_pcvar_num(p_m1)) || (zGun == DODW_K43 && get_pcvar_num(p_k43)))
				{
				if(get_user_health(victim) > 90)
					{
					new hitplace = get_tr(TR_iHitgroup)
			
					if(hitplace == HIT_LEFTARM || hitplace == HIT_RIGHTARM || hitplace == HIT_STOMACH)
						set_tr(TR_iHitgroup,HIT_CHEST)
					}
				}
			}
		}
}
